//商户过滤器
import store from '@/store';
import i18n from '../../lang';
/**
 * 商户分类
 */
export function merCategoryFilter(status) {
  if (!status) {
    return '';
  }
  let arrayList = store.getters.merchantClassify;
  let array = arrayList.filter((item) => status === item.id);
  if (array.length) {
    return array[0].name;
  } else {
    return '';
  }
}

/**
 * 商铺类型
 */
export function merchantTypeFilter(status) {
  if (!status) {
    return '';
  }
  let arrayList = store.getters.merchantType;
  let array = arrayList.filter((item) => status === item.id);
  if (array.length) {
    return array[0].name;
  } else {
    return '';
  }
}

/**
 * 商户创建类型
 */
export function merCreateTypeFilter(status) {
  const statusMap = {
    admin: i18n.t('guanLiYuanChuangJian'),
    apply: i18n.t('shangHuRuZhuShenQing'),
  };
  return statusMap[status];
}

/**
 * 商户类别
 */
export function selfTypeFilter(status) {
  const statusMap = {
    true: i18n.t('ziYing'),
    false: i18n.t('feiZiYing'),
  };
  return statusMap[status];
}
